package com.example.redstarcommerce.cn.dh.shop.controller;

import com.example.redstarcommerce.cn.dh.common.vo.Result;
import com.example.redstarcommerce.cn.dh.shop.pojo.Shop;
import com.example.redstarcommerce.cn.dh.shop.service.impl.ShopServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.UUID;

/**
 * @ClassName ShopController
 * @Author AndyWu
 * @Date 2024-11-01 22:36
 * @Motto 学不死就往死里学
 * @Version 1.0
 */

@RestController
@RequestMapping("/shop")
@Api(tags = "商品接口",description = "商品")
@Slf4j
public class ShopController {

    @Autowired
    private ShopServiceImpl shopService;

    @RequestMapping("/getall")
    @ApiOperation(value = "查询所有用户",notes = "loginUser",httpMethod = "GET")
    public Object getAll() {
        Result<List<Shop>> all = shopService.getAll();
        return all;
    }

    @RequestMapping("/insert")
    @ApiOperation(value = "商品添加",notes = "insertShop",httpMethod = "POST")
    public Object insertShop(String name,String type,String introduce,Float price) {
        Result<Boolean> shop = shopService.insertShop(name, type, introduce, price);
        return shop;
    }

    @RequestMapping("/update")
    @ApiOperation(value = "商品修改",notes = "updateShop",httpMethod = "POST")
    public Object updateShop(String uid,String name,String type,String introduce,Float price,Double scoer,Integer scoernumber) {
        Result<Boolean> shop = shopService.updateShop(uid, name, type, introduce, price, scoer, scoernumber);
        return shop;
    }
    @RequestMapping("/delete")
    @ApiOperation(value = "商品删除",notes = "deleteShop",httpMethod = "POST")
    public Object deleteShop(String uid) {
        Result<Boolean> shop = shopService.deleteShop(uid);
        return shop;
    }

}
